﻿<%@ Page Language="vb" AutoEventWireup="false" CodeFile="ProductSale.aspx.vb" Inherits="_ProductSale"  MasterPageFile="~/ITProfessionals.master"%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<br />
<br />

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ProdID" 
        DataSourceID="AccessDataSource1" ForeColor="#333333" GridLines="None">
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <Columns>
        <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
        <asp:BoundField DataField="ProdID" HeaderText="Product ID" InsertVisible="False" 
            ReadOnly="True" SortExpression="ProdID" />
        <asp:BoundField DataField="ProdName" HeaderText="Name" 
            SortExpression="ProdName" />
        <asp:BoundField DataField="ProdDesc" HeaderText="Description" 
            SortExpression="ProdDesc" />
        <asp:BoundField DataField="ProdQty" HeaderText="Qty" 
            SortExpression="ProdQty" />
        <asp:BoundField DataField="ProdPurchasePrice" HeaderText="Purchased Price" 
            SortExpression="ProdPurchasePrice" />
        <asp:BoundField DataField="ProdSalePrice" HeaderText="Sale Price" 
            SortExpression="ProdSalePrice" />
        <asp:BoundField DataField="ProdLocation" HeaderText="Location" 
            SortExpression="ProdLocation" />
        <asp:BoundField DataField="ProdStatus" HeaderText="Status" 
            SortExpression="ProdStatus" />
    </Columns>
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#999999" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>


    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" DataFile="~/Access_db/Jobs.mdb" 
        DeleteCommand="DELETE FROM [tblProducts] WHERE [ProdID] = ? AND [ProdName] = ? AND [ProdDesc] = ? AND [ProdQty] = ? AND [ProdPurchasePrice] = ? AND [ProdSalePrice] = ? AND [ProdLocation] = ? AND [ProdStatus] = ?" 
        InsertCommand="INSERT INTO [tblProducts] ([ProdName], [ProdDesc], [ProdQty], [ProdPurchasePrice], [ProdSalePrice], [ProdLocation], [ProdStatus]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [tblProducts] ORDER BY [ProdName], [ProdLocation]" 
        
        
        UpdateCommand="UPDATE [tblProducts] SET [ProdName] = ?, [ProdDesc] = ?, [ProdQty] = ?, [ProdPurchasePrice] = ?, [ProdSalePrice] = ?, [ProdLocation] = ?, [ProdStatus] = ? WHERE [ProdID] = ? AND [ProdName] = ? AND [ProdDesc] = ? AND [ProdQty] = ? AND [ProdPurchasePrice] = ? AND [ProdSalePrice] = ? AND [ProdLocation] = ? AND [ProdStatus] = ?">
        <DeleteParameters>
            <asp:Parameter Name="original_ProdID" Type="Int32" />
            <asp:Parameter Name="original_ProdName" Type="String" />
            <asp:Parameter Name="original_ProdDesc" Type="String" />
            <asp:Parameter Name="original_ProdQty" Type="Int16" />
            <asp:Parameter Name="original_ProdPurchasePrice" Type="Single" />
            <asp:Parameter Name="original_ProdSalePrice" Type="Single" />
            <asp:Parameter Name="original_ProdLocation" Type="String" />
            <asp:Parameter Name="original_ProdStatus" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="ProdName" Type="String" />
            <asp:Parameter Name="ProdDesc" Type="String" />
            <asp:Parameter Name="ProdQty" Type="Int16" />
            <asp:Parameter Name="ProdPurchasePrice" Type="Single" />
            <asp:Parameter Name="ProdSalePrice" Type="Single" />
            <asp:Parameter Name="ProdLocation" Type="String" />
            <asp:Parameter Name="ProdStatus" Type="String" />
            <asp:Parameter Name="original_ProdID" Type="Int32" />
            <asp:Parameter Name="original_ProdName" Type="String" />
            <asp:Parameter Name="original_ProdDesc" Type="String" />
            <asp:Parameter Name="original_ProdQty" Type="Int16" />
            <asp:Parameter Name="original_ProdPurchasePrice" Type="Single" />
            <asp:Parameter Name="original_ProdSalePrice" Type="Single" />
            <asp:Parameter Name="original_ProdLocation" Type="String" />
            <asp:Parameter Name="original_ProdStatus" Type="String" />
        </UpdateParameters>
        <InsertParameters>            
            <asp:Parameter Name="ProdName" Type="String" />
            <asp:Parameter Name="ProdDesc" Type="String" DefaultValue="Computer" />
            <asp:Parameter Name="ProdQty" Type="Int16" DefaultValue="0" />
            <asp:Parameter Name="ProdPurchasePrice" Type="Single" DefaultValue="0" />
            <asp:Parameter Name="ProdSalePrice" Type="Single" DefaultValue="0" />
            <asp:Parameter Name="ProdLocation" Type="String" DefaultValue="W1" />
            <asp:Parameter Name="ProdStatus" Type="String" DefaultValue="available" />
        </InsertParameters>
    </asp:AccessDataSource>

<br />
<br />       
</asp:Content>
